package com.yu.boot.lib.util;

import com.yu.boot.admin.model.User;

import javax.servlet.http.HttpServletRequest;


public class AuthUtil {

    public  static User getUser(HttpServletRequest request){
        Object user = request.getSession().getAttribute("user");
        if (user != null) {
            return (User)user;
        }
        return null;
    }

    public static String getUserName(HttpServletRequest request){
       return getUser(request).getName();
    }
}
